﻿<%--
 *  File:    VisitPlanHeader4Nova.jsp
 *  @Author: KentZhong 
 *  Date:    2009-10-9 10:02:44
 *
 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>


<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  String strModuleName = "SFE";
  	String contextPath = request.getContextPath();
%>



<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<title></title>
<PageFlow:CheckPageFlow pageName="p_visitplanheader4nova"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script>
	function page_premonth()
	{
		var cform = document.cform;
		
		cform.actionname.value = "movemonth";
		if(isEmpty(cform.reloadselfcount.value))
			cform.reloadselfcount.value="-1";
		else
			cform.reloadselfcount.value=Number(cform.reloadselfcount.value)-1;
 		cform.target="_self";
 		isRunning = true;
 		cform.submit();
	}
	function page_selectedmonth(nyear,nmonth)
	{
		var cform = document.cform;
		cform.year.value=nyear;
		cform.monthofyear.value=nmonth;
		cform.actionname.value = "selected";
 		cform.target="_self";
 		isRunning = true;
 		cform.submit();
		
	}
	function page_nextmonth()
	{
		var cform = document.cform;
		
		cform.actionname.value = "movemonth";
		if(isEmpty(cform.reloadselfcount.value))
			cform.reloadselfcount.value="1";
		else
			cform.reloadselfcount.value=Number(cform.reloadselfcount.value)+1;
 		cform.target="_self";
 		isRunning = true;
 		cform.submit();
	}
</script>	
</head>
<%@ include file="/inc/PageLocation.inc" %>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
	<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_visitplanheader4nova">
    <input type="hidden" name="actionname">
    <custom:hidden property="contactid"/>
    <custom:hidden property="orgid"/>
    <custom:hidden property="year"/>
    <custom:hidden property="monthofyear"/>
    	<custom:hidden property="reloadselfcount"/>
       <custom:hidden property="ishistory"/>	
    	<%
    	Calendar nowCal = Calendar.getInstance();
    	Integer oMonth=(Integer)pageContext.getAttribute("monthofyear");
    	if(oMonth==null)
    		oMonth=new Integer(nowCal.get(Calendar.MONTH)+1);
    		
    	Integer oYear=(Integer)pageContext.getAttribute("year");
    	if(oYear==null)
    		oYear=new Integer(nowCal.get(Calendar.YEAR));
    	
    	nowCal.set(Calendar.YEAR,oYear.intValue());
    	nowCal.set(Calendar.MONTH,oMonth.intValue()-1);
    	Integer oReloadCount=(Integer)pageContext.getAttribute("reloadselfcount");
    	int nReloadCount=0;
    	if(oReloadCount!=null)
    		nReloadCount=oReloadCount.intValue();
    	%>
    <table width="100%" border="1" cellspacing="0" cellpadding="0">
				<tr>
					<td class="title_center">
						<a onclick="javascript:page_premonth();">&lt;&lt;</a>
					</td>
					<%for(int i=-3+nReloadCount*6;i<=3+nReloadCount*6;i++)
					{
					nowCal.set(Calendar.YEAR,oYear.intValue());
    			nowCal.set(Calendar.MONTH,oMonth.intValue()-1);
					String strStype="";
					String strShowYear="";
					if(i==0)
					{
						strStype="style=\"BACKGROUND-COLOR: #fed99d\"";
						strShowYear="("+oYear+")";
					}
					else
					{
						nowCal.add(Calendar.MONTH,i);
						if(nowCal.get(Calendar.YEAR)!=oYear.intValue())
						{
							strShowYear="("+nowCal.get(Calendar.YEAR)+")";
						}
					}
					%>
					<td class="title_center" <%=strStype%>>
						<a onclick="javascript:page_selectedmonth('<%=nowCal.get(Calendar.YEAR)%>','<%=nowCal.get(Calendar.MONTH)+1%>');"><%=label.getLabelName("L_Month_"+(nowCal.get(Calendar.MONTH)+1))%><%=strShowYear%></a>
					</td>
					<%}%>
					
					<td class="title_center">
						<a onclick="javascript:page_nextmonth();">&gt;&gt;</a>
					</td>		
				<tr>
			</table>	
  </form>  
</body>
<script>
	parent.downFrame.location.href="LeaderVisitPlanSummary.jsp?contactid=<custom:write property="contactid"/>&ishistory=<custom:write property="ishistory"/>&orgid=<custom:write property="orgid"/>&year=<custom:write property="year"/>&ishistory=N&monthofyear=<custom:write property="monthofyear"/>&flag=edit&<%= OvalTools.randomURL() %>&leaderchange=y";
</script>	
</html>



